/**
 * Created by liqiao on 2017/11/27.
 */
import {Injectable} from '@angular/core';
import {Http, ResponseContentType}from '@angular/http';
import 'rxjs/add/operator/map';
import { environment } from '../../environments/environment'

@Injectable()
export class DayCostService {
    url: string;

  constructor(public http: Http) {
      this.url = environment.host + ":" + environment.port;
  }

  getDayCost() {
    return this.http.get(this.url + "/userDayCost")
      .map(res => res.json());

  }

  findByUserNo(userNo) {
    return this.http.get(this.url + "/userDayCost/findByUserNo/" + userNo)
      .map(res => res.json());
  }

  findByUserName(userName) {
    return this.http.get(this.url + "/userDayCost/findByUserName/" + userName)
      .map(res => res.json());
  }

  addDayCost(AccountRecord) {
    return this.http.post(this.url + "/userDayCost/add", AccountRecord)
      .map(res => res.json());
  }

  deleteDayCost(id){
    return this.http.get(this.url + "/userDayCost/delete/"+id)
      .map(res => res.json());
  }
}
